//
//  Datas.swift
//  JXBaseTools
//
//  Created by godox on 2021/12/8.
//

import Foundation

extension Data: JXCompatible {}

public extension JX where Base == Data {
    
    var toString: String {
        
        return String(data: base, encoding: .utf8)!
    }
    
    var toDict: Dictionary<String, Any>? {
        
        do {
            return try JSONSerialization.jsonObject(with: base, options: .mutableContainers) as? Dictionary<String, Any>
        } catch  {
            return nil
        }
    }
}


